function setShowList(data) {
    let html = '';
    console.log(data);
    for (let i = 0; i < data.length; i++) {
        html += '<li>\n' +
            '\t\t\t\t\t\t<div class="slide">\n' +
            '\t\t\t\t\t\t\t<img src="'+data[i].shoimg+'"/>\n' +
            '\t\t\t\t\t\t</div>\n' +
            '\t\t\t\t\t</li>';
        console.log(data[i].shoimg);
    }
    // html+='</ul>';
    $("#home_slider").html(html);

    console.log(html);
}
function findAllShow() {
    $.ajax({
        url: zuulhost+'/show/findAll',
        // headers:{"Authorization":token},
        // data: data,
        type: 'get',
        dataType: 'json',
        success: function (data) {
            console.log(data,11111);
            setShowList(data.data);
        }
    });
}

function setRecommList(data) {
    let html = '';
    console.log(data);
    for (let i = 0; i < data.length; i++) {
        html += '<a href="proDetail.html" onclick="keepSession('+data[i].statid+')">\n' +
            '\t\t\t\t\t\t<dl>\n' +
            '\t\t\t\t\t\t\t<dt>\n' +
            '\t\t\t\t\t\t\t\t<span class="abl"></span>\n' +
            '\t\t\t\t\t\t\t\t<img src='+data[i].topimg+' style="width: 270px; height: 270px"/>\n' +
            '\t\t\t\t\t\t\t\t<span class="abr"></span>\n' +
            '\t\t\t\t\t\t\t</dt>\n' +
            '\t\t\t\t\t\t\t<dd>'+data[i].stname+'</dd>\n' +
            '\t\t\t\t\t\t\t<dd>'+data[i].introd+'</dd>\n' +
            '\t\t\t\t\t\t\t<dd><span>'+data[i].prices+'元/小时</span></dd>\n' +
            '\t\t\t\t\t\t</dl>\n' +
            '\t\t\t\t\t</a>'
    }
    /*for (let i = 0; i < data.length; i++) {
        html += '<a href="proDetail.html" onclick="keepSession('+data[i].statid+')">\n' +
            '    <dl>\n' +
            '    <dt><img src="'+data[i].topimg+'"></dt>\n' +
            '    <dd>'+data[i].stname+' </dd>\n' +
            '    <dd>'+data[i].introd+'元/小时 </dd>\n' +
            '    <dd>'+data[i].prices+'</dd>\n' +
            '    </dl>\n' +
            '    </a>';
    }*/
    // html+='</ul>';
    $("#abody").html(html);

}

function keepSession(sessionId) {
    sessionStorage.setItem("sessionId",sessionId);
}

function findAllRecomm() {
    $.ajax({
        url: zuulhost+'/place/findStar',
        // headers:{"Authorization":token},
        // data: data,
        type: 'get',
        dataType: 'json',
        success: function (data) {
            console.log(data,11111);
            setRecommList(data.data);
        }
    });
}



$(function () {
    findAllShow();
    findAllRecomm();
});

